package com.example.isoftservice.controller;

import com.example.isoftservice.pojos.Store;
import com.example.isoftservice.service.StoreService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * ClassNmae:StoreController
 * Descriptiopn:
 *
 * @Create 2023/11/1 15:33
 * @Author yidao
 */
@RestController
@CrossOrigin
@RequestMapping("/store")
public class StoreController {
    @Resource
    StoreService storeService;

    //查询仓库信息
    @RequestMapping(value = "/searchStoreInfo",method = RequestMethod.POST)
    public Map<String,Object> searchstoreInfo(@RequestBody Store store){
        return storeService.searchStoreInfo(store);
    }

    //查询仓库id
    @RequestMapping(value = "/searchStoreId")
    public List searchStoreId(){
        return storeService.searchStoreId();
    }

    //查询产品信息
    @RequestMapping(value = "/searchProductInfo")
    public  Map<String,Object> searchProductInfo(){
        return storeService.searchProductInfo();
    }

    //查询地址信息
    @RequestMapping(value = "/searchAddressInfo")
    public Map<String,Object> searchAddressInfo(){
        return storeService.searchAddressInfo();
    }

    //删除仓库信息
    @RequestMapping(value = "/removeStoreById",method = RequestMethod.POST)
    public Map<String,Object> removeStoreById(@RequestBody Store store){
        return storeService.removeStoreById(store);
    }

    //添加仓库信息
    @RequestMapping(value = "/addStoreInfo",method = RequestMethod.POST)
    public Map<String,Object> addStoreInfo(@RequestBody Store store){
        return storeService.addStoreInfo(store);
    }

    //更新仓库信息
    @RequestMapping(value = "/modifyStoreInfo",method = RequestMethod.POST)
    public Map<String,Object> modifyStoreInfo(@RequestBody Store store){
        return storeService.modifyStoreInfo(store);
    }

    //添加产品信息
    @RequestMapping(value = "/addProductInfo",method = RequestMethod.POST)
    public Map<String,Object> addProductInfp(@RequestBody Store store){
        return storeService.addProductInfo(store);
    }

    //修改产品数量
    @RequestMapping(value = "/modifyProductNumber",method = RequestMethod.POST)
    public  Map<String, Object> modifyProductNumber(@RequestBody Store store){
        return storeService.modifyProductNumber(store);
    }

    //查询仓库是否存储满的数量
    @RequestMapping("/searchStoreNumber")
    public Map<String,Object> searchStoreNumber(){
        return storeService.searchStoreNumber();
    }

}
